-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Row and Table classes for tabular screens beyond top-processes #1243
Conversation
I didn't read the entire commit, but I have one comment here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only checked the platform-independent code so far. Several remarks and annotations.
One open question is distributing a Table
's contents onto different Screen
s while keeping single instances of various table types as needed (n:m linkage).
I don't think so, personally. I've chosen Table and Row to match with the existing use of Column throughout the code base, which is not prefixed in any way to refine/clarify its meaning - it's self evident in the Column case and I think the same is true for Row and Table. These are also the simplest possible names for these things, which is best for a base class IMO.
These aspects will be clearer once there's a second user of these classes (final commit after this one, which will be done as soon as time is available - it's an adaptation of #1102 to this though). This PR is not for approving/merging until that arrives, more to get early feedback (thanks!) and to give a heads-up that's (still) progressing.
I agree with @BenBE here, I'm finding its a much better fit to have these as 'inherited' base classes. I'm juggling a few projects here, context-switching alot, but will get updated code and the final PR in this series open ASAP for more discussion. |
023dad9
to
c44a6b3
Compare
What existing Column code base are you referring to? Because I don't see any Column.c or Column.h files.
I disagree when any one can look at the code and ask "why isn't a Hashtable derived from a Table", for example. Even a class name like
I'll wait and see. But for now, I don't think the current code refactoring make sense. |
Two more comments:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, some more comments for the stuff I didn't look at previously. Mostly consistency fixes, nothing too special. Overlaps in big parts with things already noted for the platform-independent stuff.
Not too happy yet to have tgpid (group) and uid as part of the Row class …
Currently called
Re
I know what @natoscott is going for as I helped with the GSoC project last year were most of that code was created. The refactoring now is basically the aftermath of all the cleanup not done back then. Having a look at #1102 you can get a glimpse of why the current internal structure is bad for handling things that are mostly determined at runtime. Another use (apart from the immediate PR) can be seen for things like e.g. listing open files (long term project incoming from my side, cf. lsof-org/lsof#268) live, where the current implementation is basically wrapping a static snapshot onto a list of lines to display. With this abstracted Oh, and what about views like the list of network interfaces, their IPs, traffic stats and so on … Also stuff that benefits from having the basic infrastructure for displaying arbitrary data as a table in place (and network interfaces even have a hierarchical structure based on bonding, VLANs, bridges, …). |
Noticed by BenBE in review of #1243
c44a6b3
to
fe92ef2
Compare
| What existing Column code base are you referring to? Because I don't see any Column.c or Column.h files. Ah that's a literal interpretation of what I meant - sorry, wasn't clear - what I more meant was we don't see naming like "ColumnUI" - there's lots of things that just talk just about Columns (in various contexts). Your suggestion of "Record" may well be a better name than "Row" - it was one of the options considered earlier. Row is shorter, which is goodness, and "Record" is slightly ambiguous in that it also has "saving data to disk" connotations. Naming is hard. In terms of the "not liking" the refactoring, maybe it will help to forget about the PCP use case and think more from the perspective of the cgroups discussion in #1191 - i.e. how would we need to refactor the code so that cgroups could be shown in the way processes are today (with tree-view as well, etc)? We definitely need to do exactly the sorts of things being done in this PR. This is how we've ended up with this refactoring - we have the initial PCP implementation that doesn't do this (ends up duplicating lots of Process.c/ProcessList.c code) and doesn't help the other htop platforms to move forward and allow for other types of Screens in the future. Hence, we're heading this way to try prepare the way for other platforms that might want to do this kind of thing too. |
@natoscott I'm okay when you have something in mind when you refactor the code with the new classes. I just didn't know how would, e.g, cgroups be based on these new classes, and thus missed the goal you have for this refactoring. Can you provide us a link to the ”initial PCP implementation” you are talking about, just to get a clearer vision on how the base class
I was also considering the name like |
fe92ef2
to
c0e6b80
Compare
@natoscott The dynamic screen feature for PCP looks interesting. Before I try to review the code, I have one comment on the Setup screen UI: The "Available" list (list of available screens) may be merged with the "Available columns" list (list of available columns of that screen). This would save some horizontal space as there are too many columns on that particular Setup screen. |
We would like to keep the existing htop functionality of allowing the user to choose the displayed screen name (i.e. the string shown in the tab above each Screen). Ultimately, this means these two columns need to be separate - we need a list of (not editable) screen names (i.e. 'Processes' from htop core, followed by the list of dynamic screens from configuration files) and a list of (editable) names that the user selects - the latter is based on the former, but they are different things. In the example Setup screenshot I posted, we can see "Main" and "I/O" are two differently-configured "Processes" Screens. These names can be edited as the user wishes, but since we now have more than just Processes, a separate (non-editable) column is needed to indicate what the underlying Screen is. In a similar way to Main and I/O, we can also have zero or more of each of the dynamic screens. So we could have users with multiple different Filesystem tab configurations, for example, each with different display names and different visible columns. |
You know, I cannot tell that from the screenshot you provided. I think there is a usability problem here that users cannot tell the type of the screen ("Processes") from the screen with the custom name. And the column of available screens won't help with the problem. My idea is to list the active screens with the type of the screen as well as the name. Under the "Active Screens" heading, show something like this:
The "Available Screens" should only be there if the user has pressed the "New" button to select a screen they wish to add. |
P.S. From this screenshot I saw another confusion. When the "Filesystems" screen is highlighted in the "Active" column, the "Available" column does not reflect to what the type of the "Active" screen is. Here, "Processes" is highlighted but I expect "Filesystems" be highlighted. I'm just to tell there is usability bug even with the current approach of listing available screens and available columns separately. |
That's correct - making it a two-step process is the tradeoff to reduce the busy-ness of the Screens setup page. |
We can, but we absolutely should not … ;-) Jokes aside. I've been thinking about some minimalistic notion of "dialogs" for a while, like Midnight Commander does for various operations that require user input. In the case of htop we could do something akin to:
On the main
That way the UI is minimized for the actual task at hand and the user is only presented with the options necessary at each moment. |
@BenBE I'm not sure if I get it. The "Screen" and "Screen Types" lists in your UI proposal looks okay, but I have one question: @natoscott In your proposal, how would the user's flow be for deleting a screen? How about renaming a screen (changing the display name of the tab)? |
Adding screen: Press function key according to Status Bar, enter name, select type. Renaming screen: Press function key according to Status Bar, update name, confirm with Enter. Modifying type: Ensure screen has no columns, select new type from list of available types Delete screen: Press function key according to Status Bar. Add/Modify/Remove columns: Navigate to screen, hit Enter. |
My expectation is the screen type would not be modifiable after creation. The user would have to delete the screen and then create another with the right type. |
Thus my note about "requires all columns deleted" for changing the type. Effectively boils down to deleting and re-creating that screen (sans re-entering the name). |
@BenBE interesting stuff - I like your idea of dialogs. It's quite a change from the current model though, so I'm not going to attempt it within this PR. :)
No change to how its done today from ScreensPanel. It can also be achieved from the (new) ScreenTabsPanel now, for platforms with dynamic screens. I've got an initial implementation going, working sufficiently well that the interaction can be experimented with and it feels quite intuitive to me (and is consistent with existing htop UI). There's still some bugs to be sorted out though, I'll continue working on those. |
c0e6b80
to
5caf5e2
Compare
5caf5e2
to
d44dce8
Compare
This commit refactors the Process and ProcessList structures such they each have a new parent - Row and Table, respectively. These new classes handle screen updates relating to anything that could be represented in tabular format, e.g. cgroups, filesystems, etc, without us having to reimplement the display logic repeatedly for each new entity.
a788871
to
bec8314
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
bec8314
to
e1031e7
Compare
This implements our concept of 'dynamic screens' in htop, with a first use-case of pcp-htop displaying things like top-filesystem and top-cgroups under new screen tabs. However the idea is more general than use in pcp-htop and we've paved the way here for us to collectively build mroe general tabular screens in core htop, as well. From the pcp-htop side of things, dynamic screens are configured using text-based configuration files that define the mapping for PCP metrics to columns (and metric instances to rows). Metrics are defined either directly (via metric names) or indirectly via PCP derived metric specifications. Value scaling and the units displayed is automatic based on PCP metric units and data types. This commit represents a collaborative effort of several months, primarily between myself, Nathan and BenBE. Signed-off-by: Sohaib Mohamed <[email protected]> Signed-off-by: Nathan Scott <[email protected]>
Simplify names to just Metric in this case as it is not mirroring core htop naming (which is the norm for that naming convention).
Sync up with similar code from Linux platform, so that such processes are correctly shaded and do not trip an assert in debug builds.
e1031e7
to
e557236
Compare
This is merged - if there's any platform specific build issues (Linux and PCP only verified so far), please let me know. |
Ah. I missed the chance to review this code a little bit. There are a few styling issues that I'm not sure I like it. Would you mind if I make pull requests as follows ups of this one? Here are two issues I can see at the moment:
|
@Explorer09 personally, I don't think those changes will be helpful - the reason for the RowField naming is to match up with the ProcessField naming, 'Field' is maybe a little too vague IMO. |
@natoscott I know the
|
This commit refactors the Process and ProcessList structures such they each have a new parent - Row and Table, respectively. These new classes handle screen updates relating to anything that could be represented in tabular format, e.g. cgroups, filesystems, etc, without us having to reimplement the display logic repeatedly for each new entity.